
#pragma once

#include "control/bmpbtn.h"
#include "Control\Control.h"
#include "AlphaRes.h"
#include "BaseICtrl.h"

enum BTN_STATE{ STBTN_NOR,STBTN_ACT,STBTN_DISABLE,STBTN_ALL };


class  GUI_API CFAlpResBtn 
//:public CBmpBtn
:public CBaseICtrl
{
public:
	CFAlpResBtn(void);
	CFAlpResBtn(UINT nID );
	CFAlpResBtn(wstring strCaption,UINT nID );
	CFAlpResBtn(DWORD dwStyle,wstring strCaption, const CRect &rc, UINT nID  );
	CFAlpResBtn(DWORD dwStyle, wstring strCaption, int x, int y, int cx, int cy, UINT nID  );

	virtual ~CFAlpResBtn(void);
	virtual void Click(DWORD dwClick, POINT pt);

public:
	void	SetClickSound( LPCTSTR pStrSound );


	// conctrol only have one image
	virtual BOOL	LoadRes( wstring strRes,CMyUnCompress* pPack=NULL );
	//if contrl only have one img,this function just like LoadRes,here the same
	virtual BOOL	LoadStateRes( wstring strRes,int nState,CMyUnCompress* pPack=NULL );


	BOOL	CloneStateBtn( int nSrcSt,int dst_State );
	void	RSetBtnState( int nState );

	inline void SetTextOffset(CSize szOffset){
		m_szTextOffset = szOffset;
	}


protected:
	CFAlphaRes*		m_pBtnAlpRes[STBTN_ALL];

	CSize		m_szTextOffset;
	int			m_nBtnState;
	wstring		m_strBtnWav;

public:
	// here not used
	virtual void  Paint(CDC* pDC);
	virtual void  ImprovePaint( HANDLE hDB ,HDC hdc =NULL );
	virtual void  ImproveStatePaint( HANDLE hDB ,BTN_STATE state );
	virtual void  PaintCaption( HDC hdcTxt );

	void Init();

};
